package java6703.lesson05;

import java.util.HashSet;
import java.util.Random;

public class HashSetRandom6703 {
    public static void main(String[] args) {

        Random random = new Random();
        HashSet<Integer> integers = new HashSet<>();

        //产生10个50～80之间不重复的随机数存储在HashSet中
        while (integers.size()<10){
            int num = random.nextInt(31) + 50;
            integers.add(num);
        }

        //使用用增强for把10个数输出
        for (int num:integers) {
            System.out.print(num+"    ");
        }
    }
}
